# coding: utf-8
# 处理数组和矩阵
import matplotlib.pyplot as plt
import numpy as np

n1 = plt.imread('1.png')
print(type(n1), n1)
plt.imshow(n1)

# 灰度公式
n2 = np.array([0.299, 0.587, 0.114, 0.114])

x = np.dot(n1, n2)
plt.imshow(x, cmap='gray')

plt.show()